<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let xiyou = ['唐僧', '孙悟空', '猪八戒', '沙僧'];
        //使用for...of遍历数组
        for (let v of xiyou) {
            console.log(v); //使用for of v返回的是键值 使用for in v返回的是键名
        }
        let iterator = xiyou[Symbol.iterator]();
        console.log(iterator.next());
        console.log(iterator.next());
        console.log(iterator.next());
        console.log(iterator.next());
        console.log(iterator.next());
    </script>
</body>

</html>